<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Código-Fonte de coordinate.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Gerado por Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Busca');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;Principal</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Arquivos</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Busca" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;Arquivos</span></a></li>
      <li><a href="globals.html"><span>Arquivos&nbsp;Membros</span></a></li>
    </ul>
  </div>
<h1>coordinate.h</h1><a href="coordinate_8h.html">Vá para a documentação deste arquivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef COORDINATE_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define COORDINATE_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;string&gt;</span><span class="comment">//usado em ToString()</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;cmath&gt;</span><span class="comment">//usado em pow(..), dentro de CroosOver(..) </span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="definitions_8h.html">definitions.h</a>&quot;</span><span class="comment">//classe de definições básicas do problema</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;iostream&gt;</span><span class="comment">//debug</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="comment">//bibliotecas para gerar os números aleatórios</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include&lt;stdio.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include&lt;stdlib.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include&lt;time.h&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="comment">//definições dos tipos default se encontram em definitions.h</span>
<a name="l00024"></a>00024 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty = GAtype, <span class="keyword">typename</span> _realTy = GAreal_type&gt; <span class="keyword">class </span><a class="code" href="classcoordinate.html">coordinate</a>;
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00033"></a>00033 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00034"></a>00034 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00035"></a><a class="code" href="classcoordinate.html">00035</a> <span class="keyword">class </span><a class="code" href="classcoordinate.html">coordinate</a>
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037   
<a name="l00038"></a>00038   <span class="keyword">public</span>:
<a name="l00039"></a>00039     
<a name="l00041"></a>00041     
<a name="l00042"></a>00042 <span class="preprocessor">    #ifndef pc_cte</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>    
<a name="l00044"></a>00044     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00055"></a>00055     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00056"></a>00056     <a class="code" href="classcoordinate.html#a1c690e9cfa9ce1bff5f1d64eaadd171f" title="Construtores/Destrutores.">coordinate</a> (<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; PC = def_pc,<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; indice = def::coord::indice,<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; size=def::coord::size,
<a name="l00057"></a>00057         <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; precision = def::coord::precision,<span class="keyword">const</span> _realTy&amp; max=def::coord::max, <span class="keyword">const</span> _realTy&amp; min=def::coord::min) 
<a name="l00058"></a>00058         :_pc(PC),_indice(indice),_size(size),_precision(precision),_max(max),_min(min){GenerateSize();SetCodedBound();}
<a name="l00059"></a>00059 <span class="preprocessor">    #else</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span>
<a name="l00061"></a>00061     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00071"></a>00071     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00072"></a><a class="code" href="classcoordinate.html#a1c690e9cfa9ce1bff5f1d64eaadd171f">00072</a>     <a class="code" href="classcoordinate.html#a1c690e9cfa9ce1bff5f1d64eaadd171f" title="Construtores/Destrutores.">coordinate</a> (<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; indice = def::coord::indice,<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; size=def::coord::size, <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; precision = def::coord::precision,
<a name="l00073"></a>00073         <span class="keyword">const</span> _realTy&amp; max=def::coord::max, <span class="keyword">const</span> _realTy&amp; min=def::coord::min )
<a name="l00074"></a>00074         :_indice(indice),_size(size),_precision(precision),_pc(def_pc),_max(max),_min(min)
<a name="l00075"></a>00075         {GenerateSize();SetCodedBound();}
<a name="l00076"></a>00076 <span class="preprocessor">    #endif</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span>
<a name="l00078"></a>00078     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00084"></a>00084     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00085"></a><a class="code" href="classcoordinate.html#a52212c2723e16c95a8bc6acce3d6ef4e">00085</a>     <a class="code" href="classcoordinate.html#a52212c2723e16c95a8bc6acce3d6ef4e">coordinate</a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo):_indice(0){_value = coo._value;_precision=coo._precision;_max=coo._max;
<a name="l00086"></a>00086       _min=coo._min;_size = coo._size;this-&gt;GenerateSize();<span class="comment">/*ajusta o tamanho da codificação*/</span>this-&gt;SetCodedBound();}
<a name="l00087"></a>00087     
<a name="l00088"></a>00088     
<a name="l00089"></a>00089       <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00090"></a>00090 <span class="comment">       * --- Métodos de interface get/set                                *</span>
<a name="l00091"></a>00091 <span class="comment">       * --------------------------------------------------------------- */</span>
<a name="l00092"></a>00092 
<a name="l00093"></a>00093       <span class="comment">/* ----------------------------------------*/</span>
<a name="l00099"></a>00099       <span class="comment">/* ----------------------------------------*/</span>
<a name="l00100"></a><a class="code" href="classcoordinate.html#a0e3450e6a6a1b4d577886fb68883d61c">00100</a>     <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; <a class="code" href="classcoordinate.html#a0e3450e6a6a1b4d577886fb68883d61c">GetSize</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _size;}
<a name="l00101"></a>00101 
<a name="l00102"></a>00102     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00108"></a>00108     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00109"></a><a class="code" href="classcoordinate.html#a8dca6b1375bc84a05f66d8694681acbe">00109</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a8dca6b1375bc84a05f66d8694681acbe">SetSize</a> (<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; new_size) {_size = new_size;}
<a name="l00110"></a>00110     
<a name="l00111"></a>00111     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00117"></a>00117     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00118"></a><a class="code" href="classcoordinate.html#a617500d91429987c40541973ae80662a">00118</a>     <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; <a class="code" href="classcoordinate.html#a617500d91429987c40541973ae80662a">GetIndice</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _indice;}
<a name="l00119"></a>00119     
<a name="l00120"></a>00120     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00126"></a>00126     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00127"></a><a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">00127</a>     <span class="keyword">const</span> _ty&amp; <a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">GetValue</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _value;}
<a name="l00128"></a>00128 
<a name="l00129"></a>00129     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00135"></a>00135     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00136"></a><a class="code" href="classcoordinate.html#a46e04592c97e4d4f10aad3cbe90a7a6a">00136</a>     _ty&amp; <a class="code" href="classcoordinate.html#a46e04592c97e4d4f10aad3cbe90a7a6a">GetValue</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _value;}
<a name="l00137"></a>00137 
<a name="l00138"></a>00138     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00144"></a>00144     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00145"></a><a class="code" href="classcoordinate.html#ae66e44d1146ca8020809efe799a5a59c">00145</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#ae66e44d1146ca8020809efe799a5a59c">SetValue</a> (<span class="keyword">const</span> _ty&amp; new_value) {<span class="keywordflow">if</span>(!<a class="code" href="classcoordinate.html#aa39b86f0c5c09bf06fd5b2b8655d4dc2">IsOutOfBound</a>(new_value)) _value = new_value;}
<a name="l00146"></a>00146 
<a name="l00147"></a>00147     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00153"></a>00153     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00154"></a><a class="code" href="classcoordinate.html#a84cb188432f5139c669b8fd3fc0037f5">00154</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a84cb188432f5139c669b8fd3fc0037f5">SetValue</a> (<span class="keyword">const</span> _realTy&amp; new_value) {<span class="keywordflow">if</span>(!<a class="code" href="classcoordinate.html#aa39b86f0c5c09bf06fd5b2b8655d4dc2">IsOutOfBound</a>(new_value))
<a name="l00155"></a>00155                                               <a class="code" href="classcoordinate.html#ae66e44d1146ca8020809efe799a5a59c">SetValue</a>(<a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::Code</a>(*<span class="keyword">this</span>,new_value));}
<a name="l00156"></a>00156 
<a name="l00157"></a>00157     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00161"></a>00161     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00162"></a><a class="code" href="classcoordinate.html#a33a2b235424b34d89e42422c05adc276">00162</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a33a2b235424b34d89e42422c05adc276">SetValueMinValue</a> (<span class="keywordtype">void</span>) {_value = _minCoded;}
<a name="l00163"></a>00163 
<a name="l00164"></a>00164     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00168"></a>00168     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00169"></a><a class="code" href="classcoordinate.html#a552fb17fcf9a6d74c972020d21e99709">00169</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a552fb17fcf9a6d74c972020d21e99709">SetValueMaxValue</a> (<span class="keywordtype">void</span>) {_value = _maxCoded;}
<a name="l00170"></a>00170 
<a name="l00171"></a>00171     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00177"></a>00177     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00178"></a><a class="code" href="classcoordinate.html#a92cf59fbfd315c208a5533b68ce3a3d0">00178</a>     <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; <a class="code" href="classcoordinate.html#a92cf59fbfd315c208a5533b68ce3a3d0">GetPrecision</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _precision;}
<a name="l00179"></a>00179 
<a name="l00180"></a>00180     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00186"></a>00186     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00187"></a><a class="code" href="classcoordinate.html#a46b633da2fed8687b33814122ad2ce1d">00187</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a46b633da2fed8687b33814122ad2ce1d">SetPrecision</a> (<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; new_precision) {_precision=new_precision;}
<a name="l00188"></a>00188 
<a name="l00189"></a>00189     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00195"></a>00195     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00196"></a><a class="code" href="classcoordinate.html#ad3a0bad89d7914ec157f773f445edeeb">00196</a>     <span class="keyword">const</span> _realTy&amp; <a class="code" href="classcoordinate.html#ad3a0bad89d7914ec157f773f445edeeb">GetMin</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _min;}
<a name="l00197"></a>00197 
<a name="l00198"></a>00198     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00204"></a>00204     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00205"></a><a class="code" href="classcoordinate.html#af879abf859d6f890045dc6ad558ada96">00205</a>     <span class="keyword">const</span> _realTy&amp; <a class="code" href="classcoordinate.html#af879abf859d6f890045dc6ad558ada96">GetMax</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _max;}
<a name="l00206"></a>00206 
<a name="l00207"></a>00207     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00213"></a>00213     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00214"></a><a class="code" href="classcoordinate.html#a06ceabdaa759122e5ea2436a68da951b">00214</a>     <span class="keyword">const</span> _ty&amp; <a class="code" href="classcoordinate.html#a06ceabdaa759122e5ea2436a68da951b">GetMaxCoded</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _maxCoded;}
<a name="l00215"></a>00215 
<a name="l00216"></a>00216     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00222"></a>00222     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00223"></a><a class="code" href="classcoordinate.html#ae5cae8ad8f7c0cd26d4ac1e565c2b72b">00223</a>     <span class="keyword">const</span> _ty&amp; <a class="code" href="classcoordinate.html#ae5cae8ad8f7c0cd26d4ac1e565c2b72b">GetMinCoded</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _minCoded;}
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00231"></a>00231     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00232"></a><a class="code" href="classcoordinate.html#a74810fee94eae241e36552db0041b023">00232</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a74810fee94eae241e36552db0041b023">SetMin</a> (<span class="keyword">const</span> _realTy&amp; new_min) {_min=new_min;}
<a name="l00233"></a>00233 
<a name="l00234"></a>00234     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00240"></a>00240     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00241"></a><a class="code" href="classcoordinate.html#a74e0f7eaf59e785c37b2d6f92e6f89a9">00241</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a74e0f7eaf59e785c37b2d6f92e6f89a9">SetMax</a> (<span class="keyword">const</span> _realTy&amp; new_max) {_max=new_max;}
<a name="l00242"></a>00242 
<a name="l00243"></a>00243     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00249"></a>00249     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00250"></a><a class="code" href="classcoordinate.html#a7a8c16521bfde82906c7a9013f7ef909">00250</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a7a8c16521bfde82906c7a9013f7ef909">SetMinCoded</a> (<span class="keyword">const</span> _ty&amp; new_minCoded) {_minCoded = new_minCoded;}
<a name="l00251"></a>00251 
<a name="l00252"></a>00252     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00258"></a>00258     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00259"></a><a class="code" href="classcoordinate.html#a8f1612243c59f409ca70878ea572188a">00259</a>     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a8f1612243c59f409ca70878ea572188a">SetMaxCoded</a> (<span class="keyword">const</span> _ty&amp; new_maxCoded) {_maxCoded = new_maxCoded;}
<a name="l00260"></a>00260 
<a name="l00261"></a>00261     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00267"></a>00267     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00268"></a><a class="code" href="classcoordinate.html#aa77bd1b22e652f61ced9ff8ef76fcbd9">00268</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#aa77bd1b22e652f61ced9ff8ef76fcbd9">IsConsistent</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _max&gt;_min;}<span class="comment">//retorna se as coordenadas de máximo e mínimo são coerentes</span>
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00276"></a>00276     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00277"></a><a class="code" href="classcoordinate.html#aef173b7a32cc1cdb83c35f71a15f2f59">00277</a>     _realTy <a class="code" href="classcoordinate.html#aef173b7a32cc1cdb83c35f71a15f2f59">GetInterval</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _max-_min;}
<a name="l00278"></a>00278     
<a name="l00279"></a>00279     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00287"></a>00287     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00288"></a><a class="code" href="classcoordinate.html#aa39b86f0c5c09bf06fd5b2b8655d4dc2">00288</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#aa39b86f0c5c09bf06fd5b2b8655d4dc2">IsOutOfBound</a> (<span class="keyword">const</span> _ty&amp; value)<span class="keyword"> const </span>{<span class="keywordflow">return</span> ((value&lt;_minCoded) || (value&gt;_maxCoded));}
<a name="l00289"></a>00289 
<a name="l00290"></a>00290     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00298"></a>00298     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00299"></a><a class="code" href="classcoordinate.html#a5c05c89e4d5f69ea15ae724e2494bc6c">00299</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#a5c05c89e4d5f69ea15ae724e2494bc6c">IsOutOfBound</a> (<span class="keyword">const</span> _realTy&amp; value)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classcoordinate.html#a5c05c89e4d5f69ea15ae724e2494bc6c">IsOutOfBound</a>(<a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::Code</a>(*<span class="keyword">this</span>,value));}
<a name="l00300"></a>00300     
<a name="l00301"></a>00301 <span class="preprocessor">    #ifdef pc_cte</span>
<a name="l00302"></a>00302 <span class="preprocessor"></span>
<a name="l00303"></a>00303     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00309"></a>00309     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00310"></a><a class="code" href="classcoordinate.html#a08bd46e2f1731b7042718f9c395b768d">00310</a>     <span class="keyword">const</span> <span class="keywordtype">int</span>&amp; <a class="code" href="classcoordinate.html#a08bd46e2f1731b7042718f9c395b768d">GetPC</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _pc;}
<a name="l00311"></a>00311 <span class="preprocessor">    #else</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span>    <span class="comment">/* ----------------------------------------*/</span>
<a name="l00318"></a>00318     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00319"></a>00319     <span class="keywordtype">int</span>&amp; <a class="code" href="classcoordinate.html#a08bd46e2f1731b7042718f9c395b768d">GetPC</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> _pc;}
<a name="l00320"></a>00320 
<a name="l00321"></a>00321     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00327"></a>00327     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00328"></a>00328     <span class="keywordtype">void</span> SetPc (<span class="keyword">const</span> <span class="keywordtype">int</span>&amp; new_pc) {_pc=new_pc;}
<a name="l00329"></a>00329 <span class="preprocessor">    #endif</span>
<a name="l00330"></a>00330 <span class="preprocessor"></span>    
<a name="l00331"></a>00331     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00341"></a>00341     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00342"></a>00342     <span class="keyword">static</span> _realTy <a class="code" href="classcoordinate.html#a03f63a984d0b894f2056e3014eb570a3">Decode</a> (<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo);
<a name="l00343"></a>00343 
<a name="l00344"></a>00344     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00355"></a>00355     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00356"></a>00356     <span class="keyword">static</span> _ty <a class="code" href="classcoordinate.html#adac8246ca9452ff459e46e2d1b981466">Code</a> (<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo,<span class="keyword">const</span> _realTy&amp; value);
<a name="l00357"></a>00357 
<a name="l00358"></a>00358     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00366"></a>00366     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00367"></a>00367     <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a6ee17f2dd5b36b7bc2fc7b404afb899c">GenerateCoordinate</a> (<span class="keywordtype">void</span>);
<a name="l00368"></a>00368     
<a name="l00369"></a>00369     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00378"></a>00378     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00379"></a>00379     std::string <a class="code" href="classcoordinate.html#ae7277b9648c716a4ff6f16c15c26433d">ToString</a> (<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00380"></a>00380 
<a name="l00381"></a>00381     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00391"></a>00391     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00392"></a><a class="code" href="classcoordinate.html#a03f63a984d0b894f2056e3014eb570a3">00392</a>     _realTy <a class="code" href="classcoordinate.html#a03f63a984d0b894f2056e3014eb570a3">Decode</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classcoordinate.html#a03f63a984d0b894f2056e3014eb570a3">coordinate&lt;_ty,_realTy&gt;::Decode</a>(*<span class="keyword">this</span>);}
<a name="l00393"></a>00393 
<a name="l00394"></a>00394     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00395"></a>00395 <span class="comment">     * --- Sobrecarga de operadores                                    *</span>
<a name="l00396"></a>00396 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00408"></a>00408     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00409"></a>00409     <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; <a class="code" href="classcoordinate.html#aeb156220bc0921767319774d77d0eb72">operator = </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo) ;
<a name="l00410"></a>00410     
<a name="l00411"></a>00411     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00419"></a>00419     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00420"></a><a class="code" href="classcoordinate.html#a063671d1577abcf23a36af1c996ac26a">00420</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#a063671d1577abcf23a36af1c996ac26a">operator == </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo)<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;_value == coo.<a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">GetValue</a>();}
<a name="l00421"></a>00421     
<a name="l00422"></a>00422     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00430"></a>00430     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00431"></a><a class="code" href="classcoordinate.html#a8254401d37f6be169cafb28ba10635c3">00431</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#a8254401d37f6be169cafb28ba10635c3">operator != </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo)<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;_value != coo.<a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">GetValue</a>();}
<a name="l00432"></a>00432     
<a name="l00433"></a>00433     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00441"></a>00441     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00442"></a><a class="code" href="classcoordinate.html#a9c19583af7069c444bef4a712ed7fc0c">00442</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#a9c19583af7069c444bef4a712ed7fc0c">operator &gt; </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo)<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;_value &gt; coo.<a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">GetValue</a>();}
<a name="l00443"></a>00443     
<a name="l00444"></a>00444     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00452"></a>00452     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00453"></a><a class="code" href="classcoordinate.html#a052d4f0f28d416b72fe1b8ecccf80858">00453</a>     <span class="keywordtype">bool</span> operator &lt; (const coordinate&lt;_ty,_realTy&gt;&amp; coo) <span class="keyword">const</span> {<span class="keywordflow">return</span> this-&gt;_value &lt; coo.GetValue();}
<a name="l00454"></a>00454     
<a name="l00455"></a>00455     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00463"></a>00463     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00464"></a><a class="code" href="classcoordinate.html#a2b75371880389112fd471f596429fd23">00464</a>     <span class="keywordtype">bool</span> <a class="code" href="classcoordinate.html#a2b75371880389112fd471f596429fd23">operator &gt;= </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo)<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;_value &gt;= coo.<a class="code" href="classcoordinate.html#a67e7c384fd0641455b6629a7d6a9a344">GetValue</a>();}
<a name="l00465"></a>00465     
<a name="l00466"></a>00466     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00474"></a>00474     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00475"></a><a class="code" href="classcoordinate.html#a5c4a0543683ec8a6cbe751a075bd5187">00475</a>     <span class="keywordtype">bool</span> operator &lt;= (const coordinate&lt;_ty,_realTy&gt;&amp; coo) <span class="keyword">const</span> {<span class="keywordflow">return</span> this-&gt;_value &lt;= coo.GetValue();}
<a name="l00476"></a>00476 
<a name="l00477"></a>00477     
<a name="l00478"></a>00478     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00489"></a>00489     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00490"></a>00490     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T,<span class="keyword">typename</span> U&gt; <span class="keyword">friend</span>
<a name="l00491"></a>00491     std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, const coordinate&lt;T,U&gt;&amp; coo);
<a name="l00492"></a>00492     
<a name="l00493"></a>00493     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00504"></a>00504     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00505"></a>00505     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T,<span class="keyword">typename</span> U&gt; <span class="keyword">friend</span>
<a name="l00506"></a>00506     std::istream&amp; <a class="code" href="classcoordinate.html#aacb2e8f6ef327786248a961828b53fa5">operator &gt;&gt; </a>(std::istream&amp; is, <a class="code" href="classcoordinate.html">coordinate&lt;T,U&gt;</a>&amp; coo);
<a name="l00507"></a>00507     
<a name="l00508"></a>00508   <span class="keyword">private</span>:
<a name="l00509"></a>00509 
<a name="l00510"></a>00510     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00517"></a>00517     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00518"></a>00518     <span class="keywordtype">void</span> GenerateSize (<span class="keywordtype">void</span>);
<a name="l00519"></a>00519 
<a name="l00520"></a>00520     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00524"></a>00524     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00525"></a>00525     <span class="keywordtype">void</span> SetCodedBound (<span class="keywordtype">void</span>) {<a class="code" href="classcoordinate.html#a7a8c16521bfde82906c7a9013f7ef909">SetMinCoded</a>(<a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::Code</a>(*<span class="keyword">this</span>,this-&gt;_min));
<a name="l00526"></a>00526                                <a class="code" href="classcoordinate.html#a8f1612243c59f409ca70878ea572188a">SetMaxCoded</a>(<a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::Code</a>(*<span class="keyword">this</span>,this-&gt;_max));}
<a name="l00527"></a>00527 
<a name="l00528"></a>00528     
<a name="l00529"></a>00529     <span class="keyword">const</span> <span class="keywordtype">int</span> _indice;<span class="comment">//indice da coordeanda. equivalente a qual diensão ela representa</span>
<a name="l00530"></a>00530     _ty _value;<span class="comment">//valor da coordenada</span>
<a name="l00531"></a>00531     <span class="keywordtype">int</span> _precision;<span class="comment">//precisão exigida da coordenada</span>
<a name="l00532"></a>00532     <span class="keywordtype">int</span> _size;<span class="comment">//tamanho em bits da coordenada</span>
<a name="l00533"></a>00533     _realTy _max,_min;<span class="comment">//mínimo e máximo da coordenada</span>
<a name="l00534"></a>00534     _ty _maxCoded,_minCoded;<span class="comment">//máximo e mínimo da coordenada codificados</span>
<a name="l00535"></a>00535 
<a name="l00536"></a>00536     <span class="comment">//ponto de corte</span>
<a name="l00537"></a>00537 <span class="preprocessor">    #ifdef pc_cte</span>
<a name="l00538"></a>00538 <span class="preprocessor"></span>    <span class="keyword">const</span> <span class="keywordtype">int</span> _pc;<span class="comment">//se nas definições do problema o ponto de corte for constante</span>
<a name="l00539"></a>00539 <span class="preprocessor">    #else</span>
<a name="l00540"></a>00540 <span class="preprocessor"></span>    <span class="keywordtype">int</span> _pc;<span class="comment">//ponto de corte definido como variável ou aleatório</span>
<a name="l00541"></a>00541 <span class="preprocessor">    #endif</span>
<a name="l00542"></a>00542 <span class="preprocessor"></span>    
<a name="l00543"></a>00543 };
<a name="l00544"></a>00544 
<a name="l00545"></a>00545 <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00546"></a>00546 <span class="comment"> * --- Métodos estáticos                                           *</span>
<a name="l00547"></a>00547 <span class="comment"> * --------------------------------------------------------------- */</span>
<a name="l00548"></a>00548 
<a name="l00549"></a>00549 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00550"></a><a class="code" href="classcoordinate.html#a18260f8c8efb3e0b9e5cf8181569aa98">00550</a> _realTy <a class="code" href="classcoordinate.html#a03f63a984d0b894f2056e3014eb570a3">coordinate&lt;_ty,_realTy&gt;::Decode</a> (<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo )
<a name="l00551"></a>00551 {
<a name="l00552"></a>00552         _realTy decoded;
<a name="l00553"></a>00553         decoded = _realTy(coo._value)*((coo._max-coo._min)/(pow(2,coo._size)-_realTy(1)))+coo._min;
<a name="l00554"></a>00554         <span class="keywordflow">return</span> decoded;
<a name="l00555"></a>00555 }
<a name="l00556"></a>00556 
<a name="l00557"></a>00557 
<a name="l00558"></a>00558 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00559"></a><a class="code" href="classcoordinate.html#adac8246ca9452ff459e46e2d1b981466">00559</a> _ty <a class="code" href="classcoordinate.html#adac8246ca9452ff459e46e2d1b981466">coordinate&lt;_ty,_realTy&gt;::Code</a> (<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo,<span class="keyword">const</span> _realTy&amp; value)
<a name="l00560"></a>00560 {
<a name="l00561"></a>00561         _ty coded;
<a name="l00562"></a>00562         _realTy to_convert;
<a name="l00563"></a>00563         to_convert = value-coo._min;
<a name="l00564"></a>00564         to_convert *= (pow(_realTy(2),coo._size)-1);
<a name="l00565"></a>00565         to_convert /= (coo._max-coo._min);
<a name="l00566"></a>00566         coded = int(to_convert);
<a name="l00567"></a>00567         <span class="keywordflow">return</span> coded;
<a name="l00568"></a>00568 }
<a name="l00569"></a>00569 
<a name="l00570"></a>00570 <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00571"></a>00571 <span class="comment"> * --- Métodos públicos                                            *</span>
<a name="l00572"></a>00572 <span class="comment"> * --------------------------------------------------------------- */</span>
<a name="l00573"></a>00573 
<a name="l00574"></a>00574 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00575"></a><a class="code" href="classcoordinate.html#a6ee17f2dd5b36b7bc2fc7b404afb899c">00575</a> <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html#a6ee17f2dd5b36b7bc2fc7b404afb899c">coordinate&lt;_ty,_realTy&gt;::GenerateCoordinate</a> (<span class="keywordtype">void</span>)
<a name="l00576"></a>00576 {
<a name="l00577"></a>00577 
<a name="l00578"></a>00578   <span class="comment">//Se o valor de máximo é maior que o de mínimo</span>
<a name="l00579"></a>00579   <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classcoordinate.html#aa77bd1b22e652f61ced9ff8ef76fcbd9">IsConsistent</a>())
<a name="l00580"></a>00580   {
<a name="l00581"></a>00581     _realTy interval = this-&gt;<a class="code" href="classcoordinate.html#aef173b7a32cc1cdb83c35f71a15f2f59">GetInterval</a>();
<a name="l00582"></a>00582 
<a name="l00583"></a>00583     <span class="comment">//transforma o intervalo para um número inteiro</span>
<a name="l00584"></a>00584     _ty max_value = _ty(interval*pow(10,this-&gt;<a class="code" href="classcoordinate.html#a92cf59fbfd315c208a5533b68ce3a3d0">GetPrecision</a>()));
<a name="l00585"></a>00585 
<a name="l00586"></a>00586     _ty random = rand() % max_value;
<a name="l00587"></a>00587 
<a name="l00588"></a>00588     <span class="comment">//volta para valor decimal e grava na coordenada</span>
<a name="l00589"></a>00589     _realTy new_value = _realTy(random)*_realTy(pow(10,-this-&gt;<a class="code" href="classcoordinate.html#a92cf59fbfd315c208a5533b68ce3a3d0">GetPrecision</a>()));
<a name="l00590"></a>00590     new_value += this-&gt;<a class="code" href="classcoordinate.html#ad3a0bad89d7914ec157f773f445edeeb">GetMin</a>();
<a name="l00591"></a>00591     _ty value = <a class="code" href="classcoordinate.html#adac8246ca9452ff459e46e2d1b981466">coordinate&lt;_ty,_realTy&gt;::Code</a>(*<span class="keyword">this</span>,new_value);
<a name="l00592"></a>00592     this-&gt;<a class="code" href="classcoordinate.html#ae66e44d1146ca8020809efe799a5a59c">SetValue</a>(value);
<a name="l00593"></a>00593 
<a name="l00594"></a>00594   }
<a name="l00595"></a>00595 }
<a name="l00596"></a>00596 
<a name="l00597"></a>00597 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00598"></a><a class="code" href="classcoordinate.html#ae7277b9648c716a4ff6f16c15c26433d">00598</a> <span class="keyword">inline</span> std::string <a class="code" href="classcoordinate.html#ae7277b9648c716a4ff6f16c15c26433d">coordinate&lt;_ty,_realTy&gt;::ToString</a> (<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00599"></a>00599 <span class="keyword"></span>{
<a name="l00600"></a>00600   std::string str;
<a name="l00601"></a>00601   
<a name="l00602"></a>00602   _ty mask = 1;<span class="comment">//mascara para pegar os bits</span>
<a name="l00603"></a>00603   <span class="keywordtype">int</span> shift = <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::_size</a>-1;
<a name="l00604"></a>00604   mask = mask &lt;&lt; shift;<span class="comment">//bit mais alto</span>
<a name="l00605"></a>00605   
<a name="l00606"></a>00606   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i= <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::_size</a>; i!=0; --i)
<a name="l00607"></a>00607   {<span class="comment">//pega bit a bit da coordenada</span>
<a name="l00608"></a>00608   
<a name="l00609"></a>00609     <span class="keywordflow">if</span> (mask &amp; _value)<span class="comment">//pega um bit</span>
<a name="l00610"></a>00610       str += <span class="stringliteral">&quot;1&quot;</span>;
<a name="l00611"></a>00611     <span class="keywordflow">else</span>
<a name="l00612"></a>00612       str +=<span class="stringliteral">&quot;0&quot;</span>;
<a name="l00613"></a>00613     
<a name="l00614"></a>00614     shift--;
<a name="l00615"></a>00615     mask = 1;
<a name="l00616"></a>00616     mask = mask &lt;&lt; shift;<span class="comment">//desloca para o próximo bit</span>
<a name="l00617"></a>00617     
<a name="l00618"></a>00618   }
<a name="l00619"></a>00619   
<a name="l00620"></a>00620   <span class="keywordflow">return</span> str;
<a name="l00621"></a>00621 }
<a name="l00622"></a>00622 
<a name="l00623"></a>00623 
<a name="l00624"></a>00624 <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00625"></a>00625 <span class="comment"> * --- Métodos privados                                            *</span>
<a name="l00626"></a>00626 <span class="comment"> * --------------------------------------------------------------- */</span>
<a name="l00627"></a>00627 
<a name="l00628"></a>00628 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00629"></a>00629 <span class="keywordtype">void</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;::GenerateSize</a> (<span class="keywordtype">void</span>)
<a name="l00630"></a>00630 {
<a name="l00631"></a>00631         _realTy temp = _realTy(_max)-_realTy(_min);
<a name="l00632"></a>00632         temp *= pow (_realTy(10),_realTy(_precision));
<a name="l00633"></a>00633         temp = _realTy(log10(temp)/log10(_realTy(2)));
<a name="l00634"></a>00634         temp = ceil (temp);
<a name="l00635"></a>00635         _size = int(temp);
<a name="l00636"></a>00636 }
<a name="l00637"></a>00637 
<a name="l00638"></a>00638 <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00639"></a>00639 <span class="comment"> * --- Sobrecarga de operadores                                    *</span>
<a name="l00640"></a>00640 <span class="comment"> * --------------------------------------------------------------- */</span>
<a name="l00641"></a>00641 
<a name="l00642"></a>00642 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00643"></a><a class="code" href="classcoordinate.html#aeb156220bc0921767319774d77d0eb72">00643</a> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; <a class="code" href="classcoordinate.html#aeb156220bc0921767319774d77d0eb72">coordinate&lt;_ty,_realTy&gt;::operator = </a>(<span class="keyword">const</span> <a class="code" href="classcoordinate.html">coordinate&lt;_ty,_realTy&gt;</a>&amp; coo) 
<a name="l00644"></a>00644 {
<a name="l00645"></a>00645         <span class="keywordflow">if</span> (<span class="keyword">this</span> != &amp;coo)
<a name="l00646"></a>00646         {
<a name="l00647"></a>00647                 
<a name="l00648"></a>00648                 this-&gt;_value = coo._value;
<a name="l00649"></a>00649                 this-&gt;_min = coo._min;
<a name="l00650"></a>00650                 this-&gt;_max = coo._max;
<a name="l00651"></a>00651                 this-&gt;_precision = coo._precision;
<a name="l00652"></a>00652                 this-&gt;_size = coo._size;
<a name="l00653"></a>00653                 this-&gt;GenerateSize();<span class="comment">//ajusta o tamanho da codificação</span>
<a name="l00654"></a>00654         }
<a name="l00655"></a>00655         
<a name="l00656"></a>00656         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00657"></a>00657 }
<a name="l00658"></a>00658 
<a name="l00659"></a>00659 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T,<span class="keyword">typename</span> U&gt;
<a name="l00660"></a><a class="code" href="coordinate_8h.html#aacb2e8f6ef327786248a961828b53fa5">00660</a> std::istream&amp; <a class="code" href="coordinate_8h.html#aacb2e8f6ef327786248a961828b53fa5">operator &gt;&gt; </a>(std::istream&amp; is, <a class="code" href="classcoordinate.html">coordinate&lt;T,U&gt;</a>&amp; coo)
<a name="l00661"></a>00661 {
<a name="l00662"></a>00662 
<a name="l00663"></a>00663   is &gt;&gt; coo._value;
<a name="l00664"></a>00664   is &gt;&gt; coo._precision;
<a name="l00665"></a>00665   is &gt;&gt; coo._size;
<a name="l00666"></a>00666   is &gt;&gt; coo._max;
<a name="l00667"></a>00667   is &gt;&gt; coo._min;
<a name="l00668"></a>00668 
<a name="l00669"></a>00669   <span class="comment">//Ajusta o tamanho da palavra com os novos valores de máximo </span>
<a name="l00670"></a>00670   <span class="comment">//mínimo e precisão(caso o size fornecido nao estaja correto</span>
<a name="l00671"></a>00671   coo.GenerateSize();
<a name="l00672"></a>00672 
<a name="l00673"></a>00673   <span class="comment">//ajusta os limites codificados</span>
<a name="l00674"></a>00674   coo.SetCodedBound();
<a name="l00675"></a>00675 
<a name="l00676"></a>00676   <span class="keywordflow">return</span> is;
<a name="l00677"></a>00677 }
<a name="l00678"></a>00678 
<a name="l00679"></a>00679 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T,<span class="keyword">typename</span> U&gt; 
<a name="l00680"></a><a class="code" href="coordinate_8h.html#ac6da0a94290e6364c27e4dff1a52f5e5">00680</a> std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, const coordinate&lt;T,U&gt;&amp; coo)
<a name="l00681"></a>00681 {
<a name="l00682"></a>00682   os &lt;&lt; coo._value &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; coo._precision &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; coo._size &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; coo._max &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; coo._min;
<a name="l00683"></a>00683   <span class="keywordflow">return</span> os;
<a name="l00684"></a>00684 }
<a name="l00685"></a>00685 
<a name="l00686"></a>00686 <span class="preprocessor">#endif //COORDINATE_H</span>
</pre></div></div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Todos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Arquivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Funções</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variáveis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Definições de Tipos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Amigas</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Gerado em Sat Oct 30 13:47:50 2010 por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
